package main

import "fmt"

// 匿名字段
type Person struct {
	name string
	age  int
	sex  string
}

// 自定义类型
type myStr string

// 指针类型
type School struct {
	name string
	addr string
}
type Student struct {
	Person
	id   int
	addr string
	name string //同名字段
	myStr
	int
	*School
}

func main() {
	// 初始化
	s1 := Student{Person{"san", 12, "man"}, 1, "wh", "san", "", 0, &School{
		name: "whdx",
		addr: "wh",
	}}
	fmt.Println(s1)
	s2 := Student{Person: Person{"san", 12, "man"}}
	fmt.Println(s2)

	s3 := Student{Person: Person{name: "san"}}
	fmt.Println(s3)

	fmt.Println("--------------")
	var st1 Student
	st1.name = "st1 name"
	fmt.Println(st1)
	st1.Person.name = "p1 name"
	fmt.Println(st1)
}
